import java.util.*;

class Test
{

    /**
     * 数组转化
     * https://www.nowcoder.com/questionTerminal/c55f4f15cc3f4ff0adede7f9c69fa0c1
     * @param args
     */
        public static void main(String[] args)
        {
            Scanner in = new Scanner(System.in);
            int n = in.nextInt();
            int[] nums = new int[n];
            for(int i = 0;i < n;i++) nums[i] = in.nextInt();

            Arrays.sort(nums);
            boolean f = false;
            for(int i = 1;i < n;i++){
                if(nums[i] % nums[i - 1] != 0) f = true;
            }
            if(f) System.out.println("NO");
            else System.out.println("YES");

        }

    /**
     * 添加字符
     *https://www.nowcoder.com/questionTerminal/b2b816e20e8343b49abbaf493886ce26
     */
    public static void main2(String[] args)
    {
        Scanner in = new Scanner(System.in);
        char[] s1 = in.nextLine().toCharArray();
        char[] s2 = in.nextLine().toCharArray();

        int n = s1.length;
        int m = s2.length;
        int ret = (int)1e9;
        for(int i = 0;i <=m - n;i++)
        {
            int cnt  = 0;
            for(int j = 0;j < n;j++)
                if(s1[j] != s2[i + j]) cnt++;
            ret = Math.min(ret,cnt);
        }

        System.out.println(ret);
    }

    /**
     * NC16693 装箱问题
     * https://ac.nowcoder.com/acm/problem/16693
     * @param args
     */
    public static void main3(String[] args)
    {
        Scanner in = new Scanner(System.in);
        //01多个背包
        //预处理
        int V = in.nextInt();
        in.nextLine();
        int n = in.nextInt();

        int[] v = new int[n + 1];
        for(int i = 1;i <= n;i++)
        {
            v[i] = in.nextInt();
            in.nextLine();
        }

        //背包表示 dp[i][j] 表示从容量为I 的容积内可以去得的最大容积 j

        int[] dp = new int[V + 1];

        for( int i = 1;i <= n;i++)
        {

            for( int j = V;j >= v[i];j--)
            {
                //选择i线标物品

                dp[j] = Math.max(dp[j],dp[j - v[i]] + v[i]);

            }
        }
        //dp[i][j]此时是最大容量，V - dp[i][j]就是最小容量
        System.out.println(V - dp[V]);
    }
}
